import pojo.Movie;
import system.impl.MovieSystemImpl;
import teacher.Config;
import tool.FileUtil;
import tool.LogCat;
import tool.ReaderUtil;

import java.util.List;

public class Test3 {
    public static void main(String[] args) {

        // 创建一个 MovieSystemImpl 实例并设置一些状态
        MovieSystemImpl movieSystem = new MovieSystemImpl();
        // ...（设置状态）

        // 将对象序列化到文件
        movieSystem.serializeToFile("movieSystem.ser");

        // 从文件反序列化对象
        MovieSystemImpl deserializedMovieSystem = MovieSystemImpl.deserializeFromFile("movieSystem.ser");
        if (deserializedMovieSystem != null) {
            System.out.println("Deserialized MovieSystemImpl instance:");
            // ...（打印或使用反序列化后的对象）
            deserializedMovieSystem.test();
        } else {
            System.out.println("Failed to deserialize the MovieSystemImpl instance.");
        }

        LogCat.line();
        String s = FileUtil.readFile(Config.MOVIE_PATH);
        String[] split = s.split("\n");
        for (String string : split) {
            System.out.println(string);
            Movie movies = ReaderUtil.readLine2Movie(string);
            System.out.println(movies);
            LogCat.line();

        }

    }
}
